/*
 * Schemautil.cpp
 *
 *  Created on: 22-Oct-2013
 *      Author: VIKRANTSINGH
 */
#include "Schema.h"
#include "CatalogConstants.h"
#include "../dependency/util.h"
#include "../dependency/GlobalDefines.h"

class SchemaUtil {
public:

    static void getInitialSysTableSchema(Schema& schema) {
        std::stringstream str;
        str << "SYSTABLE,4," << "TABLE_ID,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH) << "," << "TABLE_NAME,"
                << Util::int_to_string(TYPE_VARCHAR) << ","
                << Util::int_to_string(DEFAULT_LENGTH) << "," << "NO_OF_COLS,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH) << "," << "HDR_PG_NO,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH);

        schema.prepareSchemaObj(str.str());
    }

    static void getInitialSysColSchema(Schema& schema) {
        std::stringstream str;
        str << "SYSCOL,5," << "COL_ID," << Util::int_to_string(TYPE_INTEGER)
                << "," << Util::int_to_string(INTEGER_LENGTH) << ","
                << "COL_NAME," << Util::int_to_string(TYPE_VARCHAR) << ","
                << Util::int_to_string(DEFAULT_LENGTH) << "," << "COL_TYPE,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH) << "," << "COL_LENGTH,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH) << "," << "TAB_ID,"
                << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH);

        schema.prepareSchemaObj(str.str());         
    }

    static void getInitialSysIndexSchema(Schema& schema) {
        std::stringstream str;
        str << "SYSINDEX,5," << "INDEX_ID," << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH)
                << "," << "INDEX_NAME," << Util::int_to_string(TYPE_VARCHAR) << "," << Util::int_to_string(DEFAULT_LENGTH) << ","
                << "NO_OF_COLS," << Util::int_to_string(TYPE_INTEGER) << "," << Util::int_to_string(INTEGER_LENGTH) << ","
                << "INDEX_HDR_PG_NO," << Util::int_to_string(TYPE_INTEGER)
                << "," << Util::int_to_string(INTEGER_LENGTH) << ","
                << "TAB_ID," << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH);

        schema.prepareSchemaObj(str.str());
    }

    static void getInitialSysIndexColSchema(Schema& schema) {
        std::stringstream str;
        str << "SYSINDEXCOL,3," << "INDEX_COL_ID," << Util::int_to_string(
                TYPE_INTEGER) << "," << Util::int_to_string(INTEGER_LENGTH)
                << "," << "INDEX_ID," << Util::int_to_string(TYPE_INTEGER)
                << "," << Util::int_to_string(INTEGER_LENGTH) << ","
                << "SYS_COL_ID," << Util::int_to_string(TYPE_INTEGER) << ","
                << Util::int_to_string(INTEGER_LENGTH);
        schema.prepareSchemaObj(str.str());
    }


};


